<header id="topbar" class="">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="#console/user/">用户数据管理</a>
            </li>
        </ol>
    </div>
</header>

<section id="content" class="animated fadeIn">
    <div class="panel overflow" >
        <table class="table table-striped fs13" id="user-list">
            <thead>
                <tr class="bg-light">
                    <th>ID</th>
                    <th>昵称</th>
                    <th>Email</th>
                    <th>角色</th>
                    <th>权限</th>
                    <th>最后修改时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody class="admin-form">
                <% _.each(items, function(item){ %>
                    <tr data-id="<%= item.id %>" >
                        <%
                            var user_perm = "";
                            var perm_dct = {};
                            _.each(PERMISSION_ROLE, function(perm){
                                _.each(perm, function(v, k){
                                perm_dct[k] = v;
                            })})
                            var perm_attrs = item.perm.split('|');
                            if(perm_attrs.length > 1){
                                user_perm = perm_dct[perm_attrs[0]] + '['+(perm_attrs.length-1)+']';
                            }
                        %>
                        <td class=""><a href="#console/user/<%= item.id %>/" ><%= item.id %></a></td>
                        <td class=""><%= item.nickname %></td>
                        <td class=""><%= item.email %></td>
                        <td class=""><%= USER_ROLE[item.role] %></td>
                        <td class=""><%= user_perm %></td>
                        <td class=""><%= item.updated_at %></td>
                        <td class="text-left">
                            <a class="glyphicons glyphicons-pencil" href="#console/user/<%= item.id %>/"></a>
                            <a class="glyphicons glyphicons-remove_2 onClickDelete" href="javascript:;"></a>
                        </td>
                    </tr>
                <%
                }) %>
            </tbody>
        </table>
    </div>

    <div><div class="pull-left" id="page-tips"></div><div id="paginator"></div></div>
</section>

<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano">
    <div class="p20 admin-form">

        <h4 class="mt5 text-muted fw500">过滤条件：</h4>

        <hr class="short">

        <div class="section mb15">
            <label for="searchEmail" class="field prepend-icon">
                <input type="text" title="注册邮箱" name="email" id="searchEmail" class="gui-input" placeholder="注册邮箱" data-field="email" value=<%= searched.email %>>
                <label for="email" class="field-icon"><i class="fa fa-tag"></i>
                </label>
            </label>
        </div>

        <h6 class="fw400">用户类型</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchRole" name="searchRole" data-field="role">
                    <option value="-1" <%= searched.role == -1 ? 'selected' : '' %>>所有</option>
                    <% _.each(USER_ROLE, function(v, k){
                        if(info.role < k) return; %>
                        <option value="<%= k %>" <%= searched.role == k ? "selected" : "" %>> <%= v %> </option>
                    <% }) %>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>

        <hr class="short">
        <button class="btn btn-default btn-block" type="button" id="search">搜索</button>
    </div>
</aside>
<!-- End: Right Sidebar -->
